The useBuyModal hook allows users to purchase an NFT that is listed for sale on the Marketplace. It handles the buying process and transaction execution.
Copy
Ask AI
import { useBuyModal } from "@0xsequence/marketplace-sdk/react";## Into your React component:const { show: showBuyModal } = useBuyModal({ onSuccess(hash) { console.log("Buy transaction sent with hash: ", hash); }, onError,});const onClickBuy = () => { showBuyModal({ chainId, collectionAddress, tokenId, order, });};return <button onClick={onClickBuy}>Buy</button>